#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int prime[100];
int digit[100];
int main()
{
	for (int i = 2,rec=1; i < 100; i++) {
		for (int j = 2; j * j <= i; j++) {
			if (i % j == 0)goto end;
		}
		prime[rec++] = i;
	end:;
	}
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= 25&&n!=1;i++) {
		if (n % prime[i] == 0) {
			n /= prime[i];
			digit[i]++;
			i = 0;
		}
	}
	int flag = 1;
	for (int i = 1; i <= 25; i++) {
		if (digit[i] && flag) {
			flag = 0;
			if (digit[i] > 1)printf("%d^%d", prime[i], digit[i]);
			else printf("%d", prime[i]);
		}
		else if (digit[i] == 1)
			printf("*%d", prime[i]);
		else if (digit[i] > 1)
			printf("%d^%d", prime[i], digit[i]);
	}
	return 0;
}